﻿using Code_Group3.BUS;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Code_Group3.WEBFORM
{
    public partial class WithdralOtherMoney1 : System.Web.UI.Page
    {
        string acc;
        protected void Page_Load(object sender, EventArgs e)
        {
            acc = "5729349375";
        }

        protected void btn1_Click(object sender, EventArgs e)
        {
            txtAmount.Text = txtAmount.Text + "1";
        }

        protected void btn2_Click(object sender, EventArgs e)
        {
            txtAmount.Text = txtAmount.Text + "2";
        }

        protected void btn3_Click(object sender, EventArgs e)
        {
            txtAmount.Text = txtAmount.Text + "3";
        }

        protected void btn4_Click(object sender, EventArgs e)
        {
            txtAmount.Text = txtAmount.Text + "4";
        }

        protected void btn5_Click(object sender, EventArgs e)
        {
            txtAmount.Text = txtAmount.Text + "5";
        }

        protected void btn6_Click(object sender, EventArgs e)
        {
            txtAmount.Text = txtAmount.Text + "6";
        }

        protected void btn7_Click(object sender, EventArgs e)
        {
            txtAmount.Text = txtAmount.Text + "7";
        }

        protected void btn8_Click(object sender, EventArgs e)
        {
            txtAmount.Text = txtAmount.Text + "8";
        }

        protected void btn9_Click(object sender, EventArgs e)
        {
            txtAmount.Text = txtAmount.Text + "9";
        }

        protected void btn10_Click(object sender, EventArgs e)
        {
            txtAmount.Text = txtAmount.Text + "0";
        }

        protected void Button5_Click(object sender, EventArgs e)
        {
            if(Int32.Parse(txtAmount.Text)%50 !=0)
            {
                Session["Error"] = "2";
                Response.Redirect("Error.aspx");
            }
            else
            {
                if (AccountBUS.CheckWithdrawCard(acc, 2000000))
                {
                    AccountBUS.Withdraw(acc, 2000000);
                    Response.Redirect("WithdrawContinue.aspx");
                }
                else
                {
                    Session["Error"] = "1";
                    Response.Redirect("Error.aspx");
                }
            }
        }
    }
}